import request from '@u/request'
import { HttpMethod } from '@u/http'


// 查询部门下拉树结构
export function getTreeSelect () {
  return request({
    url: '/sys/dept/getTreeSelect',
    method: HttpMethod.GET
  })
}

// 根据角色ID查询部门树结构
export function getRoleDeptTreeSelect (roleId) {
  return request({
    url: '/sys/dept/getRoleDeptTreeSelect/' + roleId,
    method: HttpMethod.GET
  })
}

// 查询部门列表
export function listDept (query) {
  return request({
    url: '/sys/dept/list',
    method: HttpMethod.GET,
    params: query
  })
}

// 查询部门列表（排除节点）
export function listDeptExcludeChild (deptId) {
  return request({
    url: '/sys/dept/list/exclude/' + deptId,
    method: HttpMethod.GET
  })
}

// 查询部门详细
export function getDept (deptId) {
  return request({
    url: '/sys/dept/' + deptId,
    method: HttpMethod.GET
  })
}

// 新增部门
export function addDept (data) {
  return request({
    url: '/sys/dept',
    method: HttpMethod.POST,
    data: data
  })
}

// 修改部门
export function updateDept (data) {
  return request({
    url: '/sys/dept',
    method: HttpMethod.PUT,
    data: data
  })
}

// 删除部门
export function delDept (deptId) {
  return request({
    url: '/sys/dept/' + deptId,
    method: HttpMethod.DELETE
  })
}
